package com.ymatou.i.accounting.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*创建资金账户接口Call
*FreeMaker Template自动生成代码
*/
public class CreateAccountCall extends YmatouBaseCall{
	private static String opurl ="api/Account/CreateAccount";
	
	public CreateAccountCall() {
		super(EnvSetup.getSystemUrl("api_accounting"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	//获取 accountid
	public String getAccountId() throws Exception {
		String cid = null;
		cid = new JSONObject(getReturnData()).getJSONObject("Data").getString("AccountId");
		return cid;
	}
	
	//获取 Status
	public int getStatus() {
		int status = 0;
		try {
			status = new JSONObject(getReturnData()).getInt("StatusCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return status;
	}
	
	//获取 Msg
	public String getMsg() {
		String message = null;
		try {
			message = new JSONObject(getReturnData()).getString("Message");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return message;
	}
}